[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
ultoa() Convert Unsigned Long to String
#include <stdlib.h> Required for declarations only
char *ultoa(value,string,radix);
unsigned long value; Number to be converted
char *string; String result
int radix; Base of 'value'
ultoa() converts an unsigned long integer, 'value', to a
null-terminated string stored at 'string'. The base used to convert
'value' is specified by 'radix', which must be in the range 2 through
36, inclusive. No overflow checking is performed.
Returns: A pointer to 'string'. There is no error return.
Notes: ultoa() returns up to 33 bytes including the
terminating NULL character. The space allocated must
be large enough to hold the returned string.
-------------------------------- Example ---------------------------------
The following statements convert an unsigned long integer value into
a string, using base 16, and print the result.
#include <stdlib.h>
unsigned long val = 615584;
int radix = 16;
char buffer[40];
char *p;
main()
{
p = ultoa(val,buffer,radix);
printf("the hexadecimal representation of %ld is %s\n",val,p);
}
See Also:
itoa()
ltoa()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson